﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;

namespace MODEL.ViewModel
{
    public class Company
    {
        [DisplayName("公司ID")]
        public int CompanyId { get; set; }
        [DisplayName("单位名称")]
        [Required]
        public string CompanyName { get; set; }
        [DisplayName("单位代码")]
        public  string CompanyCode { get; set; }
        [DisplayName("单位类型")]
        [Required]
        public string CompanyType { get; set; }
        [DisplayName("所属行业")]

        public string CompanyField { get; set; }
        [DisplayName("所属地区")]
        public string CompanyAddress { get; set; }
        [DisplayName("单位电话")]
        [Required]
        public string CompanyPhone { get; set; }
        [DisplayName("单位联系人")]
        public string Comtact { get; set; }
        [DisplayName("联系人电话")]
        public string ContactPhone { get; set; }
        [DisplayName("单位简介")]
        public string CompanyIntro { get; set; }
        [DisplayName("注册用户名")]
        [Required]
        public string LoginName { get; set; }

        [DisplayName("注册密码")]
        [Required]
        public string LoginPassword { get; set; }
        [DisplayName("是否通过审核")]
        public Nullable<int> IsAudit { get; set; }
        [DisplayName("是否黑名单")]
        public Nullable<int> IsBlackList { get; set; }

        [DisplayName("审核通过原因")]
        public string AuditReason { get; set; }

        [DisplayName("公司营业执照")]
        [Required]
        public string BusinessLicense { get; set; }


        [DisplayName("审核时间")]
        public Nullable<System.DateTime> AuditTime { get; set; }


        #region 把viewmodel模型转化为modeld方法
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public MODEL.qgzx_company ToModel()
        {
            MODEL.qgzx_company poco = new MODEL.qgzx_company()
            {
                CompanyId = this.CompanyId,
                CompanyName = this.CompanyName,
                CompanyCode = this.CompanyCode,
                CompanyType = this.CompanyType,
                CompanyField = this.CompanyField,
                CompanyAddress = this.CompanyAddress,
                CompanyPhone = this.CompanyPhone,
                Comtact = this.Comtact,
                ContactPhone = this.ContactPhone,
                CompanyIntro = this.CompanyIntro,
                LoginName = this.LoginName,
                IsAudit = this.IsAudit,
                LoginPassword = this.LoginPassword,
                IsBlackList = this.IsBlackList,
                AuditReason = AuditReason,
                AuditTime = this.AuditTime,
                BusinessLicense = this.BusinessLicense
            };
            return poco;
        }
        #endregion
    }
}
